package com.yztc.yidoutang.fragment.darenshuo_fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.yztc.yidoutang.R;
import com.yztc.yidoutang.adapter.DaRenAdapter;
import com.yztc.yidoutang.adapter.QuanWuAdapter;
import com.yztc.yidoutang.bean.DaRenListBean;

import java.util.List;

/**
 * Created by My on 2016/10/18.
 */

public class DaRenShuoFragment extends Fragment implements DaRenShuoContract.View {
    private String queryWords = "";
    private ListView listView;
    private DaRenShuoContract.Presenter presenter = new DaRenShuoPresenter(this);

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_quanwuji, null);
        listView = (ListView) view.findViewById(R.id.searchqw_lv);
        initView();
        return view;
    }

    public void initView() {
        Bundle bundle=getArguments();
        queryWords=bundle.getString("queryWords");
        getDRData();
    }

    @Override
    public void getDRData() {
        presenter.getDRData(queryWords);
    }

    @Override
    public void GetDRDataSuccess(List<DaRenListBean> listBean) {
       DaRenAdapter adapter=new DaRenAdapter(getActivity(),listBean);
        listView.setAdapter(adapter);
    }

    @Override
    public void GetDRDataFail(String msg) {

    }
}
